package ui.adapter;

import android.content.Context;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.fy.fyzf.R;
import com.fy.fyzf.bean.PassengerListBean;

import org.w3c.dom.Text;

import java.util.List;

public class PassengerSourceAdapter extends BaseQuickAdapter<PassengerListBean.ListBean, BaseViewHolder> {

    private Context mContext;
    public PassengerSourceAdapter(Context context) {
        super(R.layout.item_passenger_source);
    }

    @Override
    protected void convert(BaseViewHolder helper, PassengerListBean.ListBean item) {
        helper.setText(R.id.tv_first_name, item.getCustomerName().substring(0, 1))
                .setText(R.id.tv_name, item.getCustomerName());
        TextView textView = helper.getView(R.id.tv_type);
        helper.addOnClickListener(R.id.iv_call);
        String gradle = item.getGrade() == null ? "" : item.getGrade()+"级   ";
        helper.setText(R.id.tv_gradle, gradle);
        switch (item.getCustomerStatus()) {
            case 0:
                textView.setText("求租");
                break;
            case 1:
                textView.setText("求购");
                break;
            case 2:
                textView.setText("租购");
                break;
        }

    }
}
